package lesson6;

public class Demo1 {
    public static void main(String[] args) throws CloneNotSupportedException {
        Car car = new Car("111");
       // Car car2 = (Car) car.clone();
        Driver driver1 = new Driver("张三",20,car);
        Driver driver2 = (Driver) driver1.clone();

        System.out.println("driver1:"+ driver1);
        System.out.println("driver2:"+ driver2);
        driver1.getCar().setCardNum("222");
        System.out.println("*************************");
        System.out.println("driver1:"+ driver1);
        System.out.println("driver2:"+ driver2);
        car.setCardNum("333");
        System.out.println("*************************");
        System.out.println("driver1:"+ driver1);
        System.out.println("driver2:"+ driver2);
    }
}
